//
//  ProfileCell.swift
//  Alamofire
//
//  Created by 易先生 on 2022/8/12.
//

import UIKit
import MYModule

class ProfileCell: TableViewCell {

	override func makeUI() {
		super.makeUI()
        
        contentView.backgroundColor = UIColor.background

        contentView.addSubview(titleLabel)
		contentView.addSubview(genreLabel)
        contentView.addSubview(lineView)

        titleLabel.snp.makeConstraints { make in
            make.leading.equalToSuperview().offset(48)
            make.top.equalToSuperview().offset(38)
        }

        lineView.snp.makeConstraints { make in
            make.bottom.equalToSuperview()
            make.leading.equalToSuperview().offset(15)
            make.trailing.equalToSuperview().offset(-15)
            make.height.equalTo(1)
        }
        
		genreLabel.snp.makeConstraints { make in
			make.trailing.equalToSuperview().offset(-50)
			make.centerY.equalTo(titleLabel)
		}
	}

	public func bind(to cellModel: ProfileCellViewModel) {
        self.titleLabel.text = cellModel.title
		cellModel.value.bind(to: genreLabel.rx.text).disposed(by: rx.disposeBag)
	}

    
    public lazy var titleLabel: Label = {
        let titleLabel = Label()
        titleLabel.textColor = UIColor.assist_222222
        titleLabel.font = Fonts.systemFont(ofSize: 16)
        return titleLabel
    }()
    
	private lazy var genreLabel: Label = {
		let genreLabel = Label()
		genreLabel.textColor = UIColor.theme
		genreLabel.font = Fonts.systemFont(ofSize: 16)
		return genreLabel
	}()
    
    public lazy var lineView: View = {
        let lineView = View()
        lineView.backgroundColor =  UIColor.darkBackground
        return lineView
    }()
}
